package com.enumeration;

public enum ResponseEnum {
    /**
     * ========================================================
     *                   result 正常业务逻辑中的返回
     *                   2xx表示请求成功
     *                   4xx表示错误
     * ========================================================
     * */
    /**
     * @apiDefine OK
     * @apiError 200 <code>OK</code> 请求成功
     * @apiErrorExample {json} 200
     * HTTP/1.1 200 OK
     * {
     *     "resultCode": 200,
     *     "resultMsg": "请求成功",
     *     "data": {},
     *     "errCode": null,
     *     "errMsg": null
     * }
     * */
    OK(200, "请求成功"),
    /**
     * @apiDefine NOT_EXIST
     * @apiError 404 <code>NOT_EXIST</code> 请求的数据不存在
     * @apiErrorExample {json} 404
     * HTTP/1.1 200 OK
     * {
     *     "resultCode": 400,
     *     "resultMsg": "请求失败",
     *     "data": {},
     *     "errCode": 404,
     *     "errMsg": "用户名或密码错误"
     * }
     * */
    NOT_EXIST(404, "请求的数据不存在"),
    /**
     * @apiDefine 400 请求失败 400
     * 请求失败
     * */
    /**
     * @apiDefine FAILED
     * @apiError 400 <code>FAILED</code> 请求失败
     * @apiErrorExample {json} 400
     * HTTP/1.1 200 OK
     * {
     *     "resultCode": 400,
     *     "resultMsg": "请求失败",
     *     "data": {},
     *     "errCode": null,
     *     "errMsg": null
     * }
     * */
    FAILED(400, "请求失败"),
    /**
     * @apiDefine EXIST
     * @apiError 451 <code>EXIST</code> 请求插入或修改的数据已存在
     * @apiErrorExample {json} 451
     * HTTP/1.1 200 OK
     * {
     *     "resultCode": 400,
     *     "resultMsg": "请求失败",
     *     "data": {},
     *     "errCode": 451,
     *     "errMsg": "请求插入或修改的数据已存在"
     * }
     * */
    EXIST(451, "请求插入或修改的数据已存在"),
    /**
     * ========================================================
     *                   error 错误返回
     * ========================================================
     * */

    /**
     * @apiDefine PARAMETER_MISSING
     * @apiError 452 <code>PARAMETER_MISSING</code> 缺少参数或必要参数为空
     * @apiErrorExample {json} 452
     * HTTP/1.1 452 Unauthorized
     * {
     *     "resultCode": 452,
     *     "resultMsg": "缺少参数或必要参数为空",
     *     "data": {},
     *     "errCode": 0,
     *     "errMsg": null
     * }
     * */
    PARAMETER_MISSING(452, "缺少参数或必要参数为空"),
    /**
     * @apiDefine UNAUTHENTICATED_ERROR
     * @apiError 401 <code>UNAUTHENTICATED_ERROR</code> 需要登录或登录过期
     * @apiErrorExample {json} 401
     * HTTP/1.1 401 Unauthorized
     * {
     *     "resultCode": 400,
     *     "resultMsg": "请求失败",
     *     "data": {},
     *     "errCode": 0,
     *     "errMsg": "需要登录或登录过期"
     * }
     * */
    UNAUTHENTICATED_ERROR(401, "需要登录或登录过期"),
    /**
     * @apiDefine USERNAME_PASSWORD_ERROR
     * @apiError 453 <code>USERNAME_PASSWORD_ERROR</code> 用户名或密码错误
     * @apiErrorExample {json} 453
     * HTTP/1.1 200 OK
     * {
     *     "resultCode": 400,
     *     "resultMsg": "请求失败",
     *     "data": {},
     *     "errCode": 453,
     *     "errMsg": "用户名或密码错误"
     * }
     * */
    USERNAME_PASSWORD_ERROR(453, "用户名或密码错误"),
    /**
     * @apiDefine PERMISSION_DENIED
     * @apiError 454 <code>PERMISSION_DENIED</code> 权限不足或缺少参数
     * @apiErrorExample {json} 454
     * HTTP/1.1 200 OK
     *     {
     *     "resultCode": 400,
     *     "resultMsg": "请求失败",
     *     "data": {},
     *     "errCode": 454,
     *     "errMsg": "权限不足"
     *     }
     * */
    PERMISSION_DENIED(454, "权限不足或缺少参数"),
    /**
     * @apiDefine CWZD_NOT_EXIST
     * @apiError 455 <code>CWZD_NOT_EXIST</code> 车务站段不在数据库中
     * @apiErrorExample {json} 455
     * HTTP/1.1 200 OK
     * {
     *     "resultCode": 400,
     *     "resultMsg": "请求失败",
     *     "data": {},
     *     "errCode": 455,
     *     "errMsg": "车务站段不在数据库中"
     * }
     * */
    CWZD_NOT_EXIST(455, "车务站段不在数据库中"),
    /**
     * @apiDefine UNKNOWN_TYPE
     * @apiError 456 <code>UNKNOWN_TYPE</code> 未知的类型
     * @apiErrorExample {json} 456
     * HTTP/1.1 200 OK
     * {
     *     "resultCode": 400,
     *     "resultMsg": "请求失败",
     *     "data": {},
     *     "errCode": 456,
     *     "errMsg": "未知的类型"
     * }
     * */
    UNKNOWN_TYPE(456, "未知的类型"),
    FILE_NOT_EXIST(457, "文件不存在"),
    ENCODING_FAIL(458, "编码失败"),
    /**
     * @apiDefine INSERT_ERROR
     * @apiError 459 <code>INSERT_ERROR</code> 插入失败
     * @apiErrorExample {json} 459
     * HTTP/1.1 200 OK
     * {
     *     "resultCode": 400,
     *     "resultMsg": "请求失败",
     *     "data": {},
     *     "errCode": 459,
     *     "errMsg": "插入失败"
     * }
     * */
    INSERT_ERROR(459, "插入失败"),
    /**
     * @apiDefine DUPLICATE_USERNAME
     * @apiError 460 <code>DUPLICATE_USERNAME</code> 用户名已被占用
     * @apiErrorExample {json} 460
     * HTTP/1.1 200 OK
     * {
     *     "resultCode": 400,
     *     "resultMsg": "请求失败",
     *     "data": {},
     *     "errCode": 460,
     *     "errMsg": "用户名已被占用"
     * }
     * */
    DUPLICATE_USERNAME(460, "用户名已被占用"),
    /**
     * @apiDefine FILE_DELETE_ERROR
     * @apiError 461<code>FILE_DELETE_ERROR</code> 文件删除失败
     * @apiErrorExample {json} 461
     * HTTP/1.1 200 OK
     * {
     *     "resultCode": 400,
     *     "resultMsg": "请求失败",
     *     "data": {},
     *     "errCode": 461,
     *     "errMsg": "文件删除失败"
     * }
     * */
    FILE_DELETE_ERROR(461, "文件删除失败"),
    /**
     * @apiDefine REDIS_SERVER_ERROR
     * @apiError 462<code>REDIS_SERVER_ERROR</code> Redis服务器error
     * @apiErrorExample {json} 462
     * HTTP/1.1 200 OK
     * {
     *     "resultCode": 400,
     *     "resultMsg": "请求失败",
     *     "data": {},
     *     "errCode": 462,
     *     "errMsg": "Redis服务器error"
     * }
     * */
    REDIS_SERVER_ERROR(462, "Redis服务器error"),
    /**
     * @apiDefine LOGIN_TIMEOUT
     * @apiError 463<code>LOGIN_TIMEOUT</code> 登录超时
     * @apiErrorExample {json} 463
     * HTTP/1.1 200 OK
     * {
     *     "resultCode": 400,
     *     "resultMsg": "请求失败",
     *     "data": {},
     *     "errCode": 463,
     *     "errMsg": "登录超时"
     * }
     * */
    LOGIN_TIMEOUT(463, "登录超时"),
    /**
     * @apiDefine DATA_TYPE_INVALIDE
     * @apiError 464<code>DATA_TYPE_INVALIDE</code> 数据校验不通过
     * @apiErrorExample {json} 464
     * HTTP/1.1 200 OK
     * {
     *     "resultCode": 400,
     *     "resultMsg": "请求失败",
     *     "data": {},
     *     "errCode": 464,
     *     "errMsg": "数据校验不通过"
     * }
     * */
    DATA_TYPE_INVALIDE(464, "数据校验不通过");

    private int code;
    private String msg;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    ResponseEnum(int code, String msg){
        this.code = code;
        this.msg = msg;
    }

}
